home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5878 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.mira.net.au!news
  2. From: davidw@werple.net.au (David White)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Constructor Called for Global Class Instance
  5. Date: 7 Feb 1996 19:37:22 +1100
  6. Organization: Werple Internet, Melbourne
  7. Message-ID: <4f9oc2$7g9@werple.net.au>
  8. References: <4f94ri$12p@dub-news-svc-3.compuserve.com>
  9. NNTP-Posting-Host: werple.mira.net.au
  10. Keywords: C++ Constructor
  11.  
  12. <72421.1131@compuserve.com> writes:
  13.  
  14.  
  15. >A quick question pertaining to the following snippet of code:
  16.  
  17. >// Snipet
  18. >#include "MyClass.h"
  19. >MyClass junk;
  20.  
  21. >int main(int ac, char **av)
  22. >{
  23.  
  24. >etc....
  25.  
  26. >Given that there is a constructor MyClass(), if I load this sucker up in a debugger
  27. >and set a breakpoint in the constructor function, should I break in the function? In 
  28. >other words, does the constructor of a class get called when the class is
  29. >defined outside of an executed function?
  30.  
  31. >And if this is a RTF FAQ, sorry; please point to the FAQ.
  32.  
  33. >TIA
  34. >TIA
  35.  
  36. All static and global objects are properly constructed before 'main' is 
  37. called.
  38.  
  39. David White
  40. davidw@werple.mira.net.au
  41.  
  42.